from django.db import models

from user.models import User


# Create your models here.
# 故事分类
class Category(models.Model):
    name = models.CharField(max_length=100,verbose_name='分类名称')

    def __str__(self):
        return self.name

# 使用ai生成故事之后故事的属性
class Create(models.Model):
    category = models.ForeignKey(Category,on_delete=models.CASCADE,verbose_name='故事分类')
    name = models.CharField(max_length=100,verbose_name='故事名称')
    story = models.TextField(verbose_name='故事内容')
    user = models.ForeignKey(User,on_delete=models.CASCADE,verbose_name='创建用户')

    def __str__(self):
        return self.name